<!-- 1.0 template 主要是放在html元素的(html的页面结构) -->
<template>
    <div>       //Vue 2.0 必须要有主标签包含
        <span v-text="msg" class="red"></span>
        <button @click="addd(2,3)">addd</button>
        <button @click="add1(2,3)">add1</button>
        <button @click="sub(3,3)">sub</button>
        <!-- 使用导出常量 -->
        <span>{{PI}}</span> 
        <br>
        <!-- 路由导航连接 -->
        <router-link to="/login">登入</router-link>
        <router-link to="/register">注册</router-link>
        <!-- 路由组件显示标签 -->
        <router-view></router-view>
        <br>
        <h3>主体按钮</h3>
        <mt-button type="default">default</mt-button>
        <mt-button type="primary">primary</mt-button>
        <mt-button type="danger">danger</mt-button>
        <br>
        <h3>大小按钮</h3>
        <mt-button size="small">small</mt-button>
        <mt-button size="large">large</mt-button>
        <mt-button size="normal" @click="tip">normal</mt-button>
        <br>

        <div class="mui-content">
		        <ul class="mui-table-view mui-grid-view mui-grid-9">
		            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3"><a href="#">
		                    <span class="mui-icon mui-icon-home"></span>
		                    <div class="mui-media-body">Home</div></a></li>
		            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3"><a href="#">
		                    <span class="mui-icon mui-icon-email"><span class="mui-badge">5</span></span>
		                    <div class="mui-media-body">Email</div></a></li>
		            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3"><a href="#">
		                    <span class="mui-icon mui-icon-chatbubble"></span>
		                    <div class="mui-media-body">Chat</div></a></li>
		            <!-- <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3"><a href="#">
		                    <span class="mui-icon mui-icon-location"></span>
		                    <div class="mui-media-body">location</div></a></li>
		            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3"><a href="#">
		                    <span class="mui-icon mui-icon-search"></span>
		                    <div class="mui-media-body">Search</div></a></li>
		            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3"><a href="#">
		                    <span class="mui-icon mui-icon-phone"></span>
		                    <div class="mui-media-body">Phone</div></a></li>
		            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3"><a href="#">
		                    <span class="mui-icon mui-icon-gear"></span>
		                    <div class="mui-media-body">Setting</div></a></li>
		            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3"><a href="#">
		                    <span class="mui-icon mui-icon-info"></span>
		                    <div class="mui-media-body">about</div></a></li>
		           <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3"><a href="#">
		                    <span class="mui-icon mui-icon-more"></span>
		                    <div class="mui-media-body">more</div></a></li> -->
		        </ul> 
		</div>
    </div>
    
</template>

<script>
    //import calc from './calc.js';     //全部导出对象方式写法

    //按需导入
    import {add,sub,PI} from './calc.js';  //单个函数导出使用方法 

    //导入mint-ui函数
    import { Toast } from 'mint-ui';

    //定义一个函数
    function addd(x,y) {
        console.log(x+y);
    }

    //module.exports = {  //es5导出方法

    //负责导出 .vue这个组件对象(它本质上是一个Vue对象,所以vue中该定义的元素都可以使用)
    export default{
        data(){         //等价于 es5的 data:function(){}写法
            return {
                msg:'hello vuejs111',
                PI:PI           //导出常量
            }
        },
        methods:{
            addd,     //es6写法  等价于es5 add:add
            add1:add,    //单个函数导出写法 根据上面的 import {add} from 导出的
            //add1:calc.add,
            sub:sub,
            tip:function(){         //定义一个无名函数体可以内嵌函数方法
                Toast('hello');
            }
        },
        created(){

        }
    }
</script>


<style scoped>
/* 当前页面的CSS样式写到这里,其中scoped 表示这个里面写的CSS代码只是在当前组件页面上有效,
不会去影响到其他组件页面 */

.red{
    color:red;
}
</style>



